<template>
<div>
<!--  面包屑导航-->
  <Breadcrumb></Breadcrumb>
<!--  卡片视图-->
  <el-card>
      <el-table :data="rightsList" border stripe>
        <el-table-column type="index" label="#" width="45px"></el-table-column>
        <el-table-column prop="authName" label="权限名称" ></el-table-column>
        <el-table-column prop="path" label="路径"></el-table-column>
        <el-table-column prop="level" label="权限等级">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.level==='0'">一级权限</el-tag>
            <el-tag type="success" v-else-if="scope.row.level==='1'">二级权限</el-tag>
            <el-tag type="warning" v-else>三级权限</el-tag>
          </template>
        </el-table-column>
      </el-table>
  </el-card>
</div>
</template>

<script>
import Breadcrumb from "@/components/Breadcrumb";
export default {
  name: "Rights",
  components: {Breadcrumb},
  data(){
    return{
     //权限列表
     rightsList:[]
    }
  },
  created() {
    //获取所有权限
    this.getRightsList();
  },
  methods:{
    //获取权限列表
    async getRightsList() {

      try {
        const {data: res} = await this.axios.get('rights/list');
        if (res.meta.status !== 200) {
          return this.$message.error(res.meta.msg)
        }
        this.rightsList=res.data;

      } catch (e) {
        this.$message.error("服务器出错请联系管理员")
      }
    }
  }


}
</script>

<style scoped>

</style>
